﻿package com.dk.controller;

import com.dk.pojo.Order;
import com.dk.pojo.Result;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("order")
public class OrderController {

    //查询
    @GetMapping(value = "/{orderId}")//,method = RequestMethod.GET
    public Result  test(@PathVariable("orderId") Integer orderId){

        Order order = new Order(orderId, "20191210", "北京科技职业，东科教育");
        return new Result(200,"ok",order);
    }

    //修改
    @PutMapping(value = "/{orderId}")//,method = RequestMethod.PUT
    public Result  update(@PathVariable("orderId") Integer orderId,Order order){

//        Order order = new Order(orderId, "20191210", "北京科技职业，东科教育");
        System.out.println("豆芽宁 " );
        return new Result(200,"修改成功",order);
    }

    @PostMapping()//method =RequestMethod.POST
    public Result save(@RequestBody Order order){
         //注释
      //注释12333
        return new Result(200,"添加成功",order);
    }

    @DeleteMapping(value = "/{orderId}")//,method =RequestMethod.DELETE
    public Result delete(@PathVariable("orderId") Integer orderId){
        return new Result(200,"删除成功",orderId);
    }
}
